import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


// import manage from '../components/dh_alipay_manage.vue'
// import details from '../components/dh_alipay_details.vue'

// import inform from '../components/dh_alipay_inform.vue'

// import client from '../components/dh_alipay_detclient.vue'
// import clidet from '../components/dh_alipay_clientdetails.vue'

// 挂在路由，因为这个是vue的核心专用组件，实用的install方法调用，必须用Vue.use挂载
Vue.use(Router);

// 路由注册
let routers = new Router({
    routes: [
// const routes = [
        {
            path: '/manage',
            name: '员工管理',
            // component: resolve => require(['@/components/dh_alipay_manage'], resolve)
            component: resolve => require(['../components/dh_alipay_manage'], resolve)
        },
        // {
        //     path: '/details',
        //     name: '信息详情',
        //     component: resolve => require(['../components/dh_alipay_details'], resolve)
        // },
        {
            path: '/classify',
            name: '类目管理',
            component: resolve => require(['../components/dh_alipay_classify'], resolve)
        },
        {
            path: '/shops',
            name: '门店管理',
            component: resolve => require(['../components/dh_alipay_shops'], resolve)
        },
        {
            path: '/inform',
            name: '通知',
            component: resolve => require(['../components/dh_alipay_inform'], resolve)
        },
        {
            path: '/agent',
            name: '商户代理',
            component: resolve => require(['../components/dh_alipay_agent'], resolve)
        },
        {
            path: '/business',
            name: '商户员工',
            component: resolve => require(['../components/dh_alipay_business'], resolve)
        },
        {
            path: '/user',
            name: '商户员工',
            component: resolve => require(['../components/dh_alipay_user'], resolve)
        },
        {
            path: '/usershop',
            name: '员工商店',
            component: resolve => require(['../components/dh_alipay_usershop'], resolve)
        }
        // {
        //     path: '/client/:id',
        //     name: 'client',
        //     component: resolve => require(['../components/dh_alipay_detclient'], resolve)
        // },
        // {
        //     path: '/clidet/:clientid',
        //     name: 'clidet',
        //     component: resolve => require(['../components/dh_alipay_clientdetails'], resolve)
        // }
    ]
})

// const routes = [
//     {
//         path: '/',
//         name: 'manage',
//         component: manage
//     },{
//         path: '/details',
//         name: 'details',
//         component: details,
//     },{
//         path: '/inform',
//         name: 'inform',
//         component: inform
//     },
//     { 
//         path: "/client/:id",
//         name: "client",
//         component: client 
//     },
//     { 
//         path: "/clidet/:clientid",
//         name: "clidet",
//         component: clidet  
//     }
// ]


// const router = new Router({
//     // mode: 'history',
//     base: process.env.BASE_URL,
//     routes
// })


const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default routers